using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Lutos.Control;

namespace Web
{
    public partial class FavoUpdating : Lutos.Control.PageUtilities
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int uid = this.SesUserID,
            cid = this.GetParamInt("cid"),
            rid = this.GetParamInt("rid");

            System.Text.StringBuilder sb = new StringBuilder();
            //if (uid != 2)
            {
                sb.Append("<select width='120' id='favoselect' name='FavoControl1' onchange=\"document.location=(getElementById('favoselect').value);\" class='Favo'>");
                foreach (Lutos.Favo.Favo f in this.AppFavoAdapter.GetFavos(uid))
                {
                    sb.AppendFormat("<option {0} value='{1}'>{2}</option>",
                        (f.Category_ID == cid && f.Region_ID == rid) ? "selected='selected'":"",
                        string.Format("main.aspx?cid={0}&rid={1}", f.Category_ID, f.Region_ID),
                        this.AppRegionTree[f.Region_ID].Name +" - " + this.AppCategoryTree[f.Category_ID].Name
                        );
                }
                sb.Append("</select>");
            }
            this.Page.Response.Output.Write(sb.ToString());
        }
    }
}
